package com.bawei.weekone2207a.view.home.detail

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController

/**
 * 作者：赵亮
 * 时间：2024/12/14 9:56
 * 功能：
 */
@Composable
fun DetailPage(
    navController: NavController = rememberNavController(),
    json: String = ""
) {

    Column {
        // 标题
        Box(
            modifier = Modifier
                .fillMaxWidth()
                .height(70.dp)
        ) {
            Text(text = "商品详情", modifier = Modifier.align(Alignment.Center))
            Icon(
                modifier = Modifier
                    .align(Alignment.CenterStart)
                    .padding(start = 10.dp).clickable {
                        // 返回上一个页面
                        navController.popBackStack()
                    },
                imageVector = Icons.Default.ArrowBack,
                contentDescription = null
            )
        }
        // 商品详情
    }
}

@Preview
@Composable
fun DetailPagePreview() {
    DetailPage()
}

